#[tokio::main]
async fn main() {
    let result = tokio::fs::read_to_string("README.md").await;
    match result {
        Ok(content) => println!("File contents:\n{}", content),
        Err(error) => println!("Error reading the file: {}", error),
    }

    say_hello().await;

    let handle = tokio::spawn(async {
        println!("Hello, world!");
    });

    handle.await.unwrap();

    say_goodbye().await;
    say_hello().await;

    tokio::join!(say_hello(), say_hello(), say_goodbye());

    println!("-------------");

    tokio::select! {
        _ = say_hello() => {
            println!("Hello, world!");
        }
        _ = say_goodbye() => {
            println!("Goodbye, world!");
        }
        _ = tokio::time::sleep(std::time::Duration::from_secs(5)) => {
            println!("Time's up!");
        }
    }
}

async fn say_hello() {
    tokio::time::sleep(std::time::Duration::from_secs(3)).await;
    println!("Hello, Gemiman!");
}

async fn say_goodbye() {
    tokio::time::sleep(std::time::Duration::from_secs(3)).await;
    println!("Goodbye, Gemiman!");
}
